package com.db.dao;

import java.sql.Connection;
import java.util.List;

import com.db.bean.Workclass;

import util.BaseDAO;

/**
* @author 作者:秋哲    E-mail:2810201146@qq.com:
* @version 创建时间：2020年5月21日 下午9:06:21
* @description: 
*/
public class WorkClassDAOImpl extends BaseDAO<Workclass> implements WorkClassDAO {

	@Override
	public int insert(Workclass worlclass_obj) {
		String sql = "insert into work_workclass values(null,?,?)";
		int update = update(sql, worlclass_obj.getTitle(),worlclass_obj.getUserID_id());
		return update;
	}

	@Override
	public int deleteById(int workClass_id) {
		String sql = "delete  from work_workclass where id = ?";
		int update = update(sql, workClass_id);
		return update;
	}

	@Override
	public int updateWorkClass(Workclass worlclass_obj) {
		String sql = "update work_workclass set `title`=?,userID_id=?  where id = ?";
		int update = update(sql, worlclass_obj.getTitle(),worlclass_obj.getUserID_id(),worlclass_obj.getId());
		return update;
	}

	@Override
	public List<Workclass> getAll(int user_id) {
		String sql = "select * from work_workclass where userID_id = ?";
		List<Workclass> update = queryList(sql, user_id);
		return update;
	}
	@Override
	public Workclass getByTitle(int user_id,String workClass_title) {
		String sql = "select *  from work_workclass where title = ? and userID_id = ?";
		Workclass query = query(sql, workClass_title,user_id);
		return query;
	}


	



}
